﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;

public class X3DDoc:X3DInterface
{

    private XmlDocument x3d;

    public X3DDoc()
    {
        x3d = new XmlDocument();
        x3d.LoadXml("<?xml version='1.0' encoding='UTF-8'?><Scene></Scene>");
    }

    public XmlDocument X3D
    {
        get
        {
            throw new System.NotImplementedException();
        }
        set
        {

        }


    }

    public Boolean appendNode(XmlDocument xd)
    {        
        x3d.SelectSingleNode("Scene").AppendChild(x3d.ImportNode(xd.FirstChild,true));
        return true;
    }

    public string writeToString()
    {
        return x3d.InnerXml;
    }

    public Boolean writeToFile(string path)
    {
        File.WriteAllText(path,writeToString());
        return true;
    }

    public XmlDocument writeToXML()
    {
        return x3d;
    }
}
